<%--
  Created by IntelliJ IDEA.
  User: 86136
  Date: 2020/12/9
  Time: 15:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <!--引入bootstrap的css-->
    <link rel="stylesheet" href="css/bootstrap.css" />
    <title>首页</title>
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <h3 class="text-center muted">
                电子图书管理系统
            </h3>
            <div class="row clearfix">
                <div class="col-md-6 col-md-offset-2 column ">
                    图书分类：
                    <select name="bookType">
                        <c:forEach items="${categories}" var="category">
                            <option value="${category.id}">${category.name}</option>
                        </c:forEach>
                    </select>
                </div>

                <div class="col-md-4 column">
                    <button class="btn btn-default" style="width: 200px;height: 30px">添加书籍信息</button>
                </div>

            </div>
            <hr/>
            <div class="row clearfix">
                <div class="col-md-12 column">
                    <table class="table">
                        <thead>
                        <tr>
                            <th>
                                图书编号
                            </th>
                            <th>
                                图书名称
                            </th>
                            <th>
                                图书摘要
                            </th>
                            <th>
                                上传人
                            </th>
                            <th>
                                上传时间
                            </th>
                            <th>
                                操作
                            </th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${pageBean.data}" var="entry">
                            <tr>
                                <td>
                                    ${entry.id}
                                </td>
                                <td>
                                    ${entry.title}
                                </td>
                                <td>
                                    ${entry.summary}
                                </td>
                                <td>
                                    ${entry.uploadUser}
                                </td>
                                <td>
                                    ${entry.createDate}
                                </td>
                                <td>
                                    <a href="#" class="btn btn-info" >修改</a>
                                    <a href="#" class="btn btn-info" >删除</a>
                                </td>
                            </tr>
                        </c:forEach>

                        </tbody>
                    </table>
                </div>
            </div>
            <div class="row clearfix">
                <div class="col-md-12 column">
                    <ul class="pagination">
                        <li>
                            <a href="${pageContext.request.contextPath}/derekservlet?method=pageBean&pageNum=1">首页</a>
                        </li>
                        <c:if test="${pageBean.pageCount<=1}">
                            <li>
                                <a href="${pageContext.request.contextPath}/derekservlet?method=pageBean&pageNum=1">1</a>
                            </li>
                        </c:if>
                        <c:if test="${pageBean.pageCount>1}">
                            <c:forEach begin="1" end="${pageBean.pageCount}" var="num" step="1">
                                <li>
                                    <a href="${pageContext.request.contextPath}/derekservlet?method=pageBean&pageNum=${num}">${num}</a>
                                </li>
                            </c:forEach>
                        </c:if>
                        <li>
                            <a href="${pageContext.request.contextPath}/derekservlet?method=pageBean&pageNum=${pageBean.pageCount}">尾页</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
<script type="text/javascript" src="js/bootstrap.js" ></script>
</body>
</html>
